#include <iostream>

using namespace std;

class Stack
{
public:
    Stack(int size = 10)
    {
        top = 0;
        _size = size;
        space = new int[_size];
    }
    ~Stack()
    {
        delete []space;
    }

    bool isEmpty();
    bool isFull();
    void push(int data);
    int pop();
    void dis();

private:
    int *space;
    int top;
    int _size;
};

bool Stack::isEmpty()
{
    return top == 0;
}

bool Stack::isFull()
{
    return top == _size;
}

void Stack::push(int data)
{
    if(!isFull())
    {
        space[top++] = data;
    }
    else
    {
        cout<<"The Stack is Full!"<<endl;
    }
}

int Stack::pop()
{
    if(!isEmpty())
    {
        return space[--top];
    }
    else
    {
        cout<<"The Stack is no element!"<<endl;
        return 0;
    }
}

void Stack::dis()
{
    cout<<"The Stack element is:";
    for(int i = 0; i < top; i++)
    {
        cout <<space[i]<<"  ";
    }
    cout<<endl;
}
int main()
{
    Stack s;
    Stack s2(20);
    s2.push(12);
    s2.push(13);
    s2.dis();
    return 0;
}
